<template>
    <div class="apiTree">
      <div class="apiTreeLeft blockHeight" :class="{closeBlockWidth: closeClass}">
        <apiTree @handleClickClose="handleClickClose" @getapiList="getapiList" ></apiTree>
      </div>
      <div class="apiTreeRight blockHeight">
        <apiContent ref="apicontent"></apiContent>
      </div>
    </div>
</template>

<script>
  import apiTree from './components/apiTree'
  import apiContent from './components/apiContnet'
  import {
    selectProjectAndMemberType
  } from '@/api/apiModel/apiProject.js'
  export default {
    name: 'api',
    components: {
      apiTree,
      apiContent
    },
    data() {
      return {
        closeClass: false
      }
    },
    created() {
      this.selectProjectAndMemberType()
    },
    methods: {
      selectProjectAndMemberType() {
        selectProjectAndMemberType(this.$route.query.projectId).then(res => {
          let memberType = res.data.data.memberType
          this.$store.commit('SET_MEMBERTYPE', memberType)
          console.log(this.$store.state.user.memberType)
          // let tempData = res.data.data
          // if (tempData) {
          //   if (tempData.memberType === '0') {
          //     this.isAdmin = true
          //   }
          // }
        })
      },
      handleClickClose(val) {
        this.closeClass = !val
      },
      // api列表
      getapiList(groupId, projectId) {
        this.$refs.apicontent.fetchData1(groupId, projectId)
      }
    }
  }
</script>

<style scoped>
  .closeBlockWidth{
    width: 54px !important;
  }
</style>
